package com.sxz.sbs;

import android.text.TextUtils;
import android.view.Window;
import android.view.WindowManager;

import com.sxz.sbs.app.App;
import com.sxz.sbs.app.AppConstant;
import com.sxz.sbs.base.BaseActivity;
import com.sxz.sbs.base.BasePresenter;
import com.sxz.sbs.module.home.HomeActivity;
import com.sxz.sbs.module.login.LoginActivity;

import java.util.Timer;
import java.util.TimerTask;

/**
 * 欢迎
 * @author hp
 */
public class WelComeActivity extends BaseActivity {

    @Override
    protected void init() {
        Window window = this.getWindow();
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        TimerTask task = new TimerTask(){
            @Override
            public void run(){
                if (TextUtils.isEmpty(App.preferences.getValue(AppConstant.Preference.TOKEN))) {
                    startActivity(LoginActivity.class);
                } else {
                    startActivity(HomeActivity.class);
                }
                finish();
            }
        };
        Timer timer = new Timer();
        timer.schedule(task, 2*1000);

    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_guide;
    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }


}
